#include "protocol.h"

#include <stdlib.h>

PDU *mkPDU(uint uiMsgType, uint uiMsgLen)
{
    PDU* pdu = (PDU*)malloc(sizeof (PDU) + uiMsgLen);
    if(pdu == NULL){ //判断是否成功分配内存
        exit(1);
    }
    pdu->uiMsgLen  = uiMsgLen;
    pdu->uiPDULen  = uiMsgLen + sizeof(PDU);
    pdu->uiMsgType = uiMsgType;
    return pdu;
}
